if (g_strcmp0 (method_name, "GetRole") == 0)
{
- GtkAccessibleRole role = gtk_at_context_get_accessible_role (GTK_AT_CONTEXT (self));
- guint atspi_role = gtk_accessible_role_to_atspi_role (role);
+ guint atspi_role = gtk_atspi_role_for_context (GTK_AT_CONTEXT (self));
+
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(u)", atspi_role));
}
else if (g_strcmp0 (method_name, "GetRoleName") == 0)
#include "config.h"
#include "gtkatspiutilsprivate.h"
+#include "gtkenums.h"
+#include "gtkpasswordentry.h"
/*< private >
* gtk_accessible_role_to_atspi_role:
*
* Returns: an #AtspiRole
*/
-AtspiRole
+static AtspiRole
gtk_accessible_role_to_atspi_role (GtkAccessibleRole role)
{
switch (role)
return ATSPI_ROLE_FILLER;
}
+/*<private>
+ * gtk_atspi_role_for_context:
+ * @context: a #GtkATContext
+ *
+ * Returns a suitable ATSPI role for a context, taking into account
+ * both the #GtkAccessibleRole set on the context and the type
+ * of accessible.
+ *
+ * Returns: an #AtspiRole
+ */
+AtspiRole
+gtk_atspi_role_for_context (GtkATContext *context)
+{
+ GtkAccessible *accessible = gtk_at_context_get_accessible (context);
+ GtkAccessibleRole role = gtk_at_context_get_accessible_role (context);
+
+ if (GTK_IS_PASSWORD_ENTRY (accessible))
+ return ATSPI_ROLE_PASSWORD_TEXT;
+
+ return gtk_accessible_role_to_atspi_role (role);
+}
+
GVariant *
gtk_at_spi_null_ref (void)
{
#pragma once
#include "gtkatspiprivate.h"
-#include "gtkenums.h"
+#include "gtkatcontextprivate.h"
G_BEGIN_DECLS
AtspiRole
-gtk_accessible_role_to_atspi_role (GtkAccessibleRole role);
+gtk_atspi_role_for_context (GtkATContext *context);
GVariant *
gtk_at_spi_null_ref (void);